﻿<!--#include file="conn.asp"-->
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>批量生成HTML</title>
    <style>
        body
        {
            font-size: 9pt;
            line-height: 140%;
        }
    </style>
</head>
<body>
    <%
set rs=server.createobject("adodb.recordset")
set rsm=server.createobject("adodb.recordset")
id=request("id")
rs.open "select * from zj where id="&request("id"),conn,1,1
     if not rs.eof then
	 id=rs("id")
	 cid=rs("cid")
       comic_name=""
       zjid=rs("id")
	   zjmc=rs("zjmc")
	   tpadd=rs("tpadd")
	   tpurl=rs("tpurl")
	   tpf=rs("tpf")
	   tps=rs("tps")
	   add_date=rs("adddate")
	    hits=rs("hits")
		cjitemid=rs("cjitemid")
	   datetime=year(rs("adddate"))&"-"&month(rs("adddate"))&"-"&day(rs("adddate"))
	 end if
   rs.close    
rs.open "select * from comics where id="&cid,conn,1,1
if not rs.eof then
comic_name=rs("mhmc")
comic_mhfm=rs("mhfm")
 end if
   rs.close  
rs.open "select * from zjlog where id="&cjitemid,conn,1,1
if not rs.eof then
cjwebid=rs("cjwebid")
 end if
   rs.close 

Set fso = Server.CreateObject("Scripting.FileSystemObject")
'set fr=fso.opentextfile(server.mappath("TEMP/show_2.htm"))
'pencat=fr.readall
'fr.close
pencat=ReadFromTextFile("TEMP/show_2.htm","utf-8")

zjjs=zjjs&"var images_arr = new Array();"
tpurl2=Split(tpurl,"|")
for i=0 to  ubound(tpurl2)
tpArr=Split(tpurl2(i),"/")
imgurl=imgurl&"images_arr["&i+1&"] = '"&tpArr(ubound(tpArr))&"';"
next
maxpage=i
pencat=replace(pencat,"[TITLE]",comic_name)
pencat=replace(pencat,"[ZJNAME]",zjmc)
pencat=replace(pencat,"[XZ]",xzj)
pencat=replace(pencat,"[ID]",id)
pencat=replace(pencat,"[WEB_NAME]",web_name)
pencat=replace(pencat,"[WEB_URL]",web_url)
pencat=replace(pencat,"[WEB_BA]",miibeian)
pencat=replace(pencat,"[MAXPAGE]",maxpage)
pencat=replace(pencat,"[IMGURL]",imgurl)
pencat=replace(pencat,"[IMGADDRESS]",tpadd)
pencat=replace(pencat,"[WEBURLID]",cjwebid)

pencat=replace(pencat,"[PIC]",comic_mhfm)'加入封面
pencat=adreplace(pencat)
if fso.folderexists(server.mappath("../comic/"&cid&"\"&foldername))=false then
Fso.Createfolder(server.mappath("../comic/"&cid&"\"&foldername))
end if
if fso.folderexists(server.mappath("../comic/"&cid&"/"&zjid&"\"&foldername))=false then
Fso.Createfolder(server.mappath("../comic/"&cid&"/"&zjid&"\"&foldername))
end if
'Set fout = fso.CreateTextFile(server.mappath("../comic/"&cid&"/"&zjid&"/index.htm"))
'fout.Write pencat
'fout.close
WriteToTextFile "../comic/"&cid&"/"&zjid&"/index.htm",pencat,"utf-8"

if request("type")="page" then%><font color="#FF0000">生成漫画页面完成</font><script type="text/javascript">
<!--
                                                                         setTimeout('window.close();', 500);
// -->
</script>
    <%end if%>
</body>
</html>
